package Flyweight;

import java.util.Random;

public class Client {
    public static void main(String[] args) {
        Random rd = new Random();
        PieceFactory pFactory = new PieceFactory();

        for(int i = 0; i < 19; ++i)
        {
            for(int j = 0; j < 19; ++j)
            {
                AbstractPiece p;
                if(rd.nextInt() % 2 == 0)
                    p=pFactory.getPiece("白棋");
                else
                    p=pFactory.getPiece("黑棋");
                p.play(rd.nextInt(19),rd.nextInt(19));
            }
        }
        System.out.println("总共落子的棋子个数：" + pFactory.getPieceCount());
    }
}
